﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="approverOrderList.aspx.cs" Inherits="Export.Web.Ui.pages.WebForm1" MasterPageFile="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cp_head" runat="server">
    <script src="/js/jquery.tmpl.min.js" type="text/javascript"></script>
    <script src="/js/jquery.iframe-transport.js" type="text/javascript"></script>
    <script src="/js/jquery.uniform.min.js" type="text/javascript"></script>
    <%--<script src="/js/jquery.smartWizard.min.js" type="text/javascript"></script>--%>

    <script src="/scripts/jquery.form.js"></script>
    <script src="/Scripts/datagrid-filter.js"></script>
    <script src="/Scripts/datagrid-detailview.js"></script>
    <script src="/Scripts/export/approverOrderList.js"></script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cp_body" runat="server">
    <div id="documentTab" class="easyui-tabs" style="float: left; margin-right: 10px; margin-top: 5px; width: 800px">
        <div title="แบบฟอร์ม" style="padding: 10px;" status="all">
            <h2 style="float: left">All Order</h2>
            <div class="demo-tip icon-tip" style="float: left;">
                &nbsp;
            </div>
            <div style="clear: both">
            </div>
            <table id="orderAllList" title="Order All" class="easyui-datagrid" style="width: auto; height: 500px;"
                toolbar="#toolbar" rownumbers="true"
                fitcolumns="true" singleselect="true">
                <thead>
                    <tr>
                        <th field="OrderNo" width="40" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                        </th>
                        <th field="RefOrderNo" width="50" align="center" sortable="true">เลขที่ใบสั่งซื้ออ้างอิง
                        </th>
                        <th field="PortOfShipment" width="20" align="center" sortable="true">Shipment
                        </th>
                        <th field="PortOfDestination" width="20" align="center" sortable="true">Destination
                        </th>
                        <th field="CreateBy" width="20" align="center" sortable="true">สร้างโดย
                        </th>
                       <%-- <th field="TotalQty" width="20" align="center" sortable="true">QTY
                        </th>
                        <th field="TotalAmount" width="20" align="center" sortable="true">TotalAmount
                        </th>--%>
                        <th field="OrderDate" width="20" align="center" formatter="formatDate">วันที่ในใบสั่งซื้อ
                        </th>
                        <th field="CreateDate" width="20" align="center" formatter="formatDate">วันที่สร้างเอกสาร
                        </th>
                        <th field="ApprovedTime" width="20" align="center" formatter="formatDate">วันที่อนุมัติเอกสาร
                        </th>
                        <th field="RejectedTime" width="20" align="center" formatter="formatDate">วันที่ Reject เอกสาร
                        </th>
                    </tr>
                </thead>
            </table>

            <div id="toolbar">
                <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="exportBackOrder()">Export Back Order</a> <%--<a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true"
                    onclick="OpenOrderDetailsPopup(jQuery('#orderAllList').datagrid('getSelected').OrderNo, jQuery('#orderAllList').datagrid('getSelected').Status)">เปิดแบบฟอร์ม</a>--%>
            </div>

            <div id="orderDetails" class="easyui-dialog" style="width: 1100px; height: 500px; padding: 10px 20px"
                closed="true" data-options="resizable:true,modal:true">
                <div>
                    Update ATP ล่าสุดเมื่อ : <b><span id="updateAtpTime"></span></b>
                </div>
                <table id="orderDetailsList" class="easyui-datagrid" style="width: auto; height: 350px;"
                    rownumbers="true" fitcolumns="true" singleselect="true">
                    <thead>
                        <tr>
                            <%--<th field="ck" checkbox="true"></th>--%>
                            <%-- <th field="OrderNo" width="30" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                            </th>--%>
                            <th field="ItemId" width="40" align="center" sortable="true">เลขที่สินค้า
                            </th>
                            <th field="ItemName" width="40" align="center" sortable="true">ชื่อสินค้า
                            </th>
                            <th field="Qty" width="20" align="center" sortable="true">QTY
                            </th>
                            <th field="ApproveQty" width="20" align="center" sortable="true" editor="numberbox">ATP ที่อนุมัติ
                            </th>
                            <th field="ReceivedQty" width="20" align="center" sortable="true">QTY ที่ได้รับ
                            </th>
                              <th field="ReviseQty" width="20" align="center" sortable="true" >QTY ที่ Revise ออก
                            </th>
                            <th field="RemainingQty" width="20" align="center" sortable="true" formatter="formatRemaining">QTY ที่รออยู่
                            </th>
                          
                            <th field="Plant" width="20" align="center" sortable="true" formatter="formatPlantChanged">Plant
                            </th>
                            <th field="ATP" width="20" align="center" sortable="true">ATP ที่ใช้ได้
                            </th>
                            <th field="ATPSB" width="20" align="center" sortable="true">ATP SB
                            </th>
                            <th field="ATPRY" width="20" align="center" sortable="true">ATP RY
                            </th>
                            <th field="ATPTotal" width="20" align="center" sortable="true">ATP รวม
                            </th>
                            <%--  <th field="Rate" width="20" align="center" sortable="true" editor="numberbox" formatter="formatSpecialRate">%
                            </th>
                          <th field="ValidFrom" width="20" align="center" sortable="true" editor="datebox" formatter="formatDate">ValidFrom
                            </th>
                            <th field="ValidTo" width="20" align="center" sortable="true" editor="datebox" formatter="formatDate">ValidTo
                            </th>--%>
                            <th field="Comment" width="20" align="center" editor="textarea">Comment
                            </th>
                            <th field="IsDeleteFromQueue" width="10" align="center" formatter="formatDelete">Delete From Queue
                            </th>
                            <th field="MaterialNo" width="20" align="center" formatter="formatLinkATP">View ATP
                            </th>
                             <th field="ProductId" width="20" align="center" formatter="formatConfirmStatus">Status
                            </th>
                            <th field="OrderNo" width="20" align="center" formatter="formatLinkTransectionDetail">View Transaction
                            </th>
                        </tr>
                    </thead>
                </table>
                <br />
                <div>
                    <div style="float: left" class="panelApprover">
                        <a id="UpdateAtpButton" href="#" class="easyui-linkbutton" onclick="javascript:updateATP();">Update ATP</a>
                    </div>
                    <div class="panelSC" style="float: right; margin-left: 8px;">
                        <a href="#" class="easyui-linkbutton" onclick="javascript:jQuery('#orderDetails').dialog('close')">Close</a>
                    </div>
                      <div class="saveComment" style="float: right; margin-right: 10px;">
                        <a href="#" class="easyui-linkbutton" onclick="javascript:SaveComment();">SaveComment</a>
                    </div>
                    <div id="panelApprover" style="float: right; margin-left: 8px;" class="panelApprover">
                        <%-- <a href="#" class="easyui-linkbutton" onclick="javascript:approveDocument(false);">Reject</a>--%>
                        <a href="#" class="easyui-linkbutton" onclick="javascript:approveDocument(true)">Approve</a>
                    </div>
                    <div id="panelSC" class="panelSC" style="float: right; margin-left: 8px;">
                        <a href="#" class="easyui-linkbutton" onclick="javascript:saveDocument(2);">Send To approver</a>
                        <a href="#" class="easyui-linkbutton" onclick="javascript:saveDocument();">Save</a>
                    </div>
                </div>

                <div id="AtpDetails" class="easyui-dialog" style="width: 600px; padding: 10px 20px"
                    closed="true" data-options="resizable:true,modal:true">
                    <table id="AtpDetailsList" class="easyui-datagrid" style="width: auto; height: 300px;"
                        rownumbers="true" fitcolumns="true" singleselect="true">
                        <thead>
                            <tr>
                                <th field="Plant" width="30" align="center">Plant
                                </th>
                                <th field="StorageLocation" width="30" align="center" sortable="true">Storage Location
                                </th>
                                <th field="ATPQty" width="20" align="center" sortable="true">ATP Qty
                                </th>
                                <th field="URQty" width="20" align="center" sortable="true">UR Qty
                                </th>
                                <th field="UIQty" width="20" align="center" sortable="true">UI Qty
                                </th>
                                <th field="BlackedQty" width="20" align="center" sortable="true">Blacked Qty
                                </th>
                            </tr>
                        </thead>
                    </table>
                    <div>
                        <div id="panelAtpDetailButton" style="float: right">
                            <a id="selectAtp" href="#" class="easyui-linkbutton" onclick="javascript:SelectAtp();">Select</a>
                            <a href="#" class="easyui-linkbutton" onclick="javascript:jQuery('#AtpDetails').dialog('close')">Cancel</a>
                        </div>
                    </div>
                </div>
                <div id="transectionDetails" class="easyui-dialog" style="width: 600px; padding: 10px 20px"
                    closed="true" data-options="resizable:true,modal:true">
                    <table id="transectionDetailsList" class="easyui-datagrid" style="width: auto; height: 300px;"
                        rownumbers="true" fitcolumns="true" singleselect="true" showfooter="true">
                        <thead>
                            <tr>
                                <th field="Plant" width="30" align="center">Plant
                                </th>
                                <th field="Qty" width="30" align="center" sortable="true" formatter="formatQty">QTY
                                </th>
                                <th field="PalletDetailId" width="20" align="center">PalletDetailId
                                </th>
                                <th field="Result" width="20" align="center">Mat NO From Sap
                                </th>
                                 <th field="MMoveSubCate" width="30" align="center">MMoveSubCate
                                </th>
                                 <th field="Mreverse" width="30" align="center">Mreverse
                                </th>
                                <th field="UpdateBy" width="20" align="center">UpdateBy
                                </th>
                                <th field="UpdateDate" width="20" align="center">Date
                                </th>

                            </tr>
                        </thead>
                    </table>
                    <div>
                        <div style="float: right">
                            <a href="#" class="easyui-linkbutton" onclick="javascript:jQuery('#transectionDetails').dialog('close')">Close</a>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div title="Wait for approve" style="padding: 10px;" status="Wait for approve">
            <table id="orderWaitForApproveList" title="Order Wait for approve" class="easyui-datagrid" style="width: auto; height: 500px;"
                toolbar="#toolbar" pagination="true" pagesize="10" loadfilter="pagerFilter" rownumbers="true"
                fitcolumns="true" singleselect="true">
                <thead>
                    <tr>

                        <th field="OrderNo" width="40" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                        </th>
                        <th field="RefOrderNo" width="50" align="center" sortable="true">เลขที่ใบสั่งซื้ออ้างอิง
                        </th>
                        <th field="PortOfShipment" width="20" align="center" sortable="true">Shipment
                        </th>
                        <th field="PortOfDestination" width="20" align="center" sortable="true">Destination
                        </th>
                        <th field="CreateBy" width="20" align="center" sortable="true">สร้างโดย
                        </th>
                     <%--   <th field="TotalQty" width="20" align="center" sortable="true">QTY
                        </th>--%>

                        <th field="OrderDate" width="20" align="center" formatter="formatDate">วันที่ในใบสั่งซื้อ
                        </th>
                        <th field="CreateDate" width="20" align="center" formatter="formatDate">วันที่สร้างเอกสาร
                        </th>
                    </tr>
                </thead>
            </table>
        </div>
        <div title="On Process" style="padding: 10px;" status="On Queue">
            <table id="orderOnQueueList" title="Order On Queue" class="easyui-datagrid" style="width: auto; height: 500px;"
                toolbar="#toolbar" pagination="true" pagesize="10" loadfilter="pagerFilter" rownumbers="true"
                fitcolumns="true" singleselect="true">
                <thead>
                    <tr>

                        <th field="OrderNo" width="40" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                        </th>
                        <th field="RefOrderNo" width="50" align="center" sortable="true">เลขที่ใบสั่งซื้ออ้างอิง
                        </th>
                        <th field="PortOfShipment" width="20" align="center" sortable="true">Shipment
                        </th>
                        <th field="PortOfDestination" width="20" align="center" sortable="true">Destination
                        </th>
                        <th field="CreateBy" width="20" align="center" sortable="true">สร้างโดย
                        </th>
                      <%--  <th field="TotalQty" width="20" align="center" sortable="true">QTY
                        </th>--%>

                        <th field="OrderDate" width="20" align="center" formatter="formatDate">วันที่ในใบสั่งซื้อ
                        </th>
                        <th field="CreateDate" width="20" align="center" formatter="formatDate">วันที่สร้างเอกสาร
                        </th>
                        <th field="ApprovedTime" width="20" align="center" formatter="formatDate">วันที่อนุมัติเอกสาร
                        </th>
                    </tr>
                </thead>
            </table>
        </div>
        <div title="Finished" style="padding: 10px;" status="Completed">
            <table id="orderCompletedList" title="Order Completed" class="easyui-datagrid" style="width: auto; height: 500px;"
                toolbar="#toolbar" pagination="true" pagesize="10" loadfilter="pagerFilter" rownumbers="true"
                fitcolumns="true" singleselect="true">
                <thead>
                    <tr>

                        <th field="OrderNo" width="40" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                        </th>
                        <th field="RefOrderNo" width="50" align="center" sortable="true">เลขที่ใบสั่งซื้ออ้างอิง
                        </th>
                        <th field="PortOfShipment" width="20" align="center" sortable="true">Shipment
                        </th>
                        <th field="PortOfDestination" width="20" align="center" sortable="true">Destination
                        </th>
                        <th field="CreateBy" width="20" align="center" sortable="true">สร้างโดย
                        </th>
                        <%--<th field="TotalQty" width="20" align="center" sortable="true">QTY
                        </th>--%>

                        <th field="OrderDate" width="20" align="center" formatter="formatDate">วันที่ในใบสั่งซื้อ
                        </th>
                        <th field="CreateDate" width="20" align="center" formatter="formatDate">วันที่สร้างเอกสาร
                        </th>
                        <th field="ApprovedTime" width="20" align="center" formatter="formatDate">วันที่อนุมัติเอกสาร
                        </th>
                    </tr>
                </thead>
            </table>
        </div>
        <%--  <div title="Rejected" style="padding: 10px;" status="Rejected">
            <table id="rejectedList" title="Rejected" class="easyui-datagrid" style="width: auto; height: 500px;"
                 pagination="true" pagesize="10" loadfilter="pagerFilter" rownumbers="true"
                fitcolumns="true" singleselect="true">
                <thead>
                    <tr>

                        <th field="OrderNo" width="30" align="center" sortable="true">เลขที่ใบสั่งซื้อ
                        </th>
                        <th field="RefOrderNo" width="50" align="center" sortable="true">เลขที่ใบสั่งซื้ออ้างอิง
                        </th>
                        <th field="PortOfShipment" width="20" align="center" sortable="true">Shipment
                        </th>
                        <th field="PortOfDestination" width="20" align="center" sortable="true">Destination
                        </th>
                        <th field="CreateBy" width="20" align="center" sortable="true">สร้างโดย
                        </th>
                        <th field="TotalQty" width="20" align="center" sortable="true">QTY
                        </th>

                        <th field="OrderDate" width="20" align="center"  formatter="formatDate">วันที่ในใบสั่งซื้อ
                        </th>
                        <th field="CreateDate" width="20" align="center"  formatter="formatDate">วันที่สร้างเอกสาร
                        </th>
                        <th field="RejectedTime" width="20" align="center"  formatter="formatDate">วันที่ Reject เอกสาร
                        </th>
                    </tr>
                </thead>
            </table>
            
        </div>--%>
    </div>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cp_scriptBelow" runat="server">
</asp:Content>
